package exception

import uuid "github.com/satori/go.uuid"

var (
	RunMode = DEV   // dev/test/stage/prod
	Domain  = "Svc" // api/crontab/queue
)

func SetDomain(domain string) {
	Domain = domain + "_" + uuid.NewV4().String()
}

func SetDomainWithUUID(domain string) {
	Domain = domain
}

const (
	DEV   = "dev"
	TEST  = "test"
	STAGE = "stage"
	PROD  = "prod"
)

// 定义错误
const (
	LoginInvalidCode     = 40002
	LoginExpiredCode     = 40003
	AccountNotExistCode  = 40004
	AccountNotExistsCode = 40011 // 账号不存在
	AccountExistsCode    = 40010 // 账号已存在

	SystemErrorCode       = 50000 // 系统通用报错
	ParametersInvalidCode = 50001
	UserNotRelation       = 50002
	DoNotRepeatCode       = 50005
	NoAuthCode            = 50006
	CorpNotAuthCode       = 50007

	AgentCanSeeCode = 50016 //存在成员不可见

	AccountsDisabled = 42000 // 账号禁用

)

// error
var (
	// 用户登录授权错误
	LoginInvalidError     = NewError(LoginInvalidCode, "登录状态无效，请重新登录")
	LoginExpiredError     = NewError(LoginExpiredCode, "登录状态已过期，请重新登录")
	AccountNotExistError  = NewError(AccountNotExistCode, "账号不存在")
	SystemError           = NewError(SystemErrorCode, "服务器开小差了，过会儿重试")
	ParametersInvalid     = NewError(ParametersInvalidCode, "参数有误或格式不合法")
	DoNotRepeat           = NewError(DoNotRepeatCode, "请勿重复或频繁操作，请稍后再试")
	AccountsDisabledError = NewError(AccountsDisabled, "该账号被禁用")
	UserNotRelationError  = NewError(UserNotRelation, "无关系数据")
	AccountNotExistsError = NewError(AccountNotExistsCode, "账号不存在")
	AccountExistsError    = NewError(AccountExistsCode, "账号已存在")
)
